//首页展示页 
import 'package:flutter/material.dart';
import 'package:test_xzkdemo/pages/function/hometab.dart';
import 'package:test_xzkdemo/pages/function/goodslist.dart';
import 'package:test_xzkdemo/pages/function/mypage.dart';
import 'package:test_xzkdemo/pages/function/homepage.dart';

class HomePage extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
   	//初始化标签
     List<Widget> tabs = [
       _renderTab(new Text("首页")),
       _renderTab(new Text("商品列表")),
       _renderTab(new Text("我的"))
     ];
     //一个控件，可以监听返回键
     return new WillPopScope(
       onWillPop: null,
       child: new TabBarWidget(
         title: new Text("demo的app"),
         type: TabBarWidget.BOTTOM_TAB,
         tabItems: tabs,
         tabViews: [
           new HomeMainPage(),
           new GoodsListPage(),
           new MinePage()
         ],
         backgroundColor: Theme.of(context).primaryColor,
         indicatorColor: Theme.of(context).indicatorColor,
       ),
     );
   }
 /*
  * 创建标题布局
  */
   _renderTab(text) {
     //返回一个标签
     return new Tab(
       child:new Container(
       	//设置paddingTop为6
         padding: new EdgeInsets.only(top: 6),
         //一个列控件
         child: new Column(
           //竖直方向居中
           mainAxisAlignment: MainAxisAlignment.center,
           //水平方向居中
           crossAxisAlignment: CrossAxisAlignment.center,
           children: <Widget>[text],
         ),
       )
     );
   }
}
